package service

import (
	"context"

	v1 "kratosErrCode/api/helloworld/v1"
	"kratosErrCode/internal/biz"
)

// GreeterService is a greeter service.
type GreeterService struct {
	v1.UnimplementedGreeterServer

	uc *biz.GreeterUsecase
}

// NewGreeterService new a greeter service.
func NewGreeterService(uc *biz.GreeterUsecase) *GreeterService {
	return &GreeterService{uc: uc}
}

// 模拟正常返回结果
func (s *GreeterService) SayHello(ctx context.Context, in *v1.HelloRequest) (*v1.HelloReply, error) {
	return s.uc.CreateGreeter(ctx, in)
}

// 模拟404错误响应
func (s *GreeterService) GetUser(ctx context.Context, req *v1.Empty) (*v1.Empty, error) {
	return s.uc.GetUser(ctx, req)
}
